package com.sinosoft.ebusiness.service.spring;

import com.bugull.mongo.BuguConnection;
import com.bugull.mongo.BuguDao;
import com.mongodb.WriteResult;
import com.sinosoft.ebusiness.dao.NspInterLogDao;
import com.sinosoft.ebusiness.docment.NspInterLog;
import com.sinosoft.ebusiness.service.face.NosqlService;
import com.sinosoft.ebusiness.util.MongoUtils;
import org.springframework.stereotype.Service;


import java.util.Set;

@Service
public class NosqlServiceImpl implements NosqlService {



    BuguConnection comm = MongoUtils.getConnection();

    public String save(Object obj) {
        NspInterLogDao dao = new NspInterLogDao();
        WriteResult wr = dao.save((NspInterLog) obj);
        return String.valueOf(wr.getUpsertedId());
    }

    public Set<String> getCollectionNames() {
        Set<String> set = comm.getDB().getCollectionNames();
        return set;
    }


}
